<template>
  <div>
    <div class="laoding">
      <div v-if="loading">
        <div v-html="apply">{{ apply }}</div>
        <i class="el-icon-loading"></i> 正在唤起支付,请等待...
      </div>
      <div v-else>
        <i class="el-icon-success" style="font-size: 62px; color: #42a332"></i>
        <div style="margin-top: 15px">支付成功！</div>
      </div>
    </div>
  </div>
</template>
 
<script>
export default {
  name: "applyText",
  data() {
    return {
      apply: "",
      loading: true,
    };
  },
  mounted() {
    if (this.getQueryString("out_trade_no")) {
      this.loading = false;
      return;
    }
    this.loading = true;
    this.apply = this.$route.query.htmls;
    this.$nextTick(() => {
      document.forms[0].submit();
    });
  },
  methods: {
    //获取链接上的字段
    getQueryString(name) {
      var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
      var r = window.location.search.substr(1).match(reg);
      if (r != null) return unescape(r[2]);
      return null;
    },
  },
};
</script>
 
<style scoped>
.laoding {
  text-align: center;
  font-size: 16px;
  margin: 10vh 0;
}
</style>